<meta charset="utf-8">
<?php
session_start();
$username=$_SESSION['username'];
$title=$_POST['title'];
$content=$_POST['content'];
if($content==""||$title=="")
{ 
	echo "<script type='text/javascript'>alert('请输入评论或标题');location='hy.php';</script>";
}
else
{
    require_once("mysql.php"); 
	 /*$pdh=mysql_connect("localhost","root","1");
	 $db=mysql_select_db("my_db");*/
	 $sql="insert into test2(username,title,comment) values ('$username','$title','$content')"; 
    $result=mysql_query($sql); 
    if(!$result) 
    {  
       echo"<script type='text/javascript'>alert('评论失败');location='hy.php';</script>";  
    } 
    else   
    {  
       echo"<script type='text/javascript'>alert('评论成功');location='hy.php';</script>";  
    }
}
?>